#include "cardtest1.h"

void testSteward(struct gameState* state, int player){
    int failed_tests = 0;
    int result;
    int bonus = 0;
    int preCount = state->handCount[player];
    //basic steward case, draw two cards for player
    result = cardEffect(steward,1,0,0,state,1,&bonus);
    if(result !=0 ||preCount==state->handCount[player] ){
        printf("Failed test for drawing two cards for steward for player %i \n",player);
        failed_tests+=1;
    }
    //add two coins case
    int preCoins = state->coins;
    result = cardEffect(steward,2,0,0,state,1,&bonus);
    if(result!=0 || preCoins+2 !=state->coins){
        printf("Failed test for adding two coins for player %i \n",player);
        failed_tests+=1;
    }
    //trash 2 cards case
    int preHandCount = state->handCount[player];
    result = cardEffect(steward,3,0,state->handCount[player]-1,state,1,&bonus);
    //3 cards in total must be discarded for steward to be appeased
    if(result !=0 || preHandCount-3 !=state->handCount[player]){
        printf("Failed test for discard state for player %i \n",player);
        failed_tests+=1;
    }
    if(failed_tests==0){
        printf("All tests for steward card passed.\n");
    }
    else{
        printf("Number of failed tests for the steward card is: %i.\n",failed_tests);
    }
}
int main(int argc, char** argv){
    int cards[10] = {adventurer, council_room, feast, gardens, mine,
        remodel, smithy, village, baron, great_hall};
    struct gameState* game =newGame();
    int initialized = initializeGame(2,cards,42,game);
    if(initialized!=-1){
        testSteward(game,0);
    }
    return 0;
    
}